﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Models;

namespace BLL
{
    public class BugManager
    {
        private BugService objBugService = new BugService();
        /// <summary>
        /// 判断bug表中是否有对应行
        /// 有：更新数据 没有：新增数据
        /// </summary>
        /// <param name="bug"></param>
        /// <returns></returns>
        public void InsertBug(BugClass bug)
        {
            int count = objBugService.GetBug(bug.WorkParentId);
            if (count == 1)
            {
                objBugService.UpdateBug(bug);
            }
            else
            {
                objBugService.InsertBug(bug);
            }
        }
        /// <summary>
        /// 获取bug信息
        /// </summary>
        /// <param name="workParentId"></param>
        /// <returns></returns>
        public BugClass GetBugInfo(int workParentId)
        {
            return objBugService.GetBugInfo(workParentId);
        }
         /// <summary>
        /// 根据节点名称查询bug信息
        /// </summary>
        /// <param name="nodeName"></param>
        /// <returns></returns>
        public List<BugClass> GetAllBugInfo(string nodeName,string pName,string mName)
        {
            return objBugService.GetAllBugInfo(nodeName,pName,mName);
        }
    }
}
